<?php 


function getTableData($page, $limit, $kode)
{   
    include "koneksiDB.php";
    $startRow = ($page - 1) * $limit;
    $query1='SELECT * FROM artikel WHERE kode='.$kode.' LIMIT '.$startRow.', '.$limit ;    
    $dataTable=$conn->query($query1);   
    return $dataTable;
}
function showPagination($limit,$kode)
{
    $countTotalRow = $conn->query('SELECT COUNT * AS total FROM artikel WHERE kode='.$kode);
    while($ro = $countTotalRow->fetch_assoc()) {
        $totalRow = $ro['total'];
    
    $totalPage = ceil($totalRow / $limit);
 
    $page = 1;
    while ($page <= $totalPage) 
    {
        echo '<a href="?page='.$page.'&perPage='.$limit.'">'.$page.'</a>';
        if ($page < $totalPage)
            echo " | ";
 
        $page++;
    }
    }
}
?>
